home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Apple II Sample Code / MPW IIGS SC / SC.005.Custom.Window / cwnd.aii next >
Encoding:
Text File  |  1990-06-24  |  18.0 KB  |  796 lines  |  [TEXT/MPS ]

  1. *******************************************************************************
  2. * Custom Window Application -- Version 3.0
  3. *
  4. * (C)  Copyright Apple Computer, Inc. 1988-1990
  5. * All rights reserved.
  6. *
  7. * Developer Technical Support Apple II Sample Code
  8. *
  9. * by Keith Rollin
  10. *
  11. * This program is not much more than the standard shell that brings up three
  12. * windows. Two of these windows are custom RoundRect windows, and the third
  13. * one is normal window presented for comparison. This program also shows the
  14. * use of _AlertWindow, a call new to System Disk 3.2, and the use of NULL
  15. * events to draw the current time in the menubar.
  16. *
  17. *******************************************************************************
  18. **********************************************************************
  19. *                                                                    *
  20. *     This program and its derivatives are licensed only for         *
  21. *     use on Apple computers.                                        *
  22. *                                                                    *
  23. *     Works based on this program must contain and                   *
  24. *     conspicuously display this notice.                             *
  25. *                                                                    *
  26. *     This software is provided for your evaluation and to           *
  27. *     assist you in developing software for the Apple IIGS           *
  28. *     computer.                                                      *
  29. *                                                                    *
  30. *     DISCLAIMER OF WARRANTY                                         *
  31. *                                                                    *
  32. *     THE SOFTWARE IS PROVIDED "AS IS" WITHOUT                       *
  33. *     WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,               *
  34. *     WITH RESPECT TO ITS MERCHANTABILITY OR ITS FITNESS             *
  35. *     FOR ANY PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO             *
  36. *     THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH            *
  37. *     YOU.  SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU (AND            *
  38. *     NOT APPLE OR AN APPLE AUTHORIZED REPRESENTATIVE)               *
  39. *     ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING,             *
  40. *     REPAIR OR CORRECTION.                                          *
  41. *                                                                    *
  42. *     Apple does not warrant that the functions                      *
  43. *     contained in the Software will meet your requirements          *
  44. *     or that the operation of the Software will be                  *
  45. *     uninterrupted or error free or that defects in the             *
  46. *     Software will be corrected.                                    *
  47. *                                                                    *
  48. *     SOME STATES DO NOT ALLOW THE EXCLUSION                         *
  49. *     OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY              *
  50. *     NOT APPLY TO YOU.  THIS WARRANTY GIVES YOU SPECIFIC            *
  51. *     LEGAL RIGHTS AND YOU MAY ALSO HAVE OTHER RIGHTS                *
  52. *     WHICH VARY FROM STATE TO STATE.                                *
  53. *                                                                    *
  54. *                                                                    *
  55. **********************************************************************
  56.     eject
  57.     
  58.     PRINT NOGEN,NOHDR
  59.  
  60.     STRING ASIS
  61.     case   on
  62.  
  63.     PRINT PUSH,OFF
  64.     INCLUDE 'M16.Util2'
  65.     INCLUDE 'M16.ProDOS'
  66.     INCLUDE 'M16.MiscTool'
  67.     INCLUDE 'M16.QUICKDRAW'
  68.     INCLUDE 'E16.Quickdraw'
  69.     INCLUDE 'M16.MEMORY'
  70.     INCLUDE 'E16.Memory'
  71.     INCLUDE 'M16.EVENT'
  72.     INCLUDE 'E16.EVENT'
  73.     INCLUDE 'M16.LOCATOR'
  74.     INCLUDE 'M16.Menu'
  75.     INCLUDE 'M16.Control'
  76.     INCLUDE 'M16.Window'
  77.     INCLUDE 'E16.Window'
  78.     INCLUDE 'M16.Dialog'
  79.     INCLUDE 'E16.Dialog'
  80.     INCLUDE 'M16.LineEdit'
  81.     INCLUDE 'M16.IntMath'
  82.     INCLUDE 'M16.Scrap'
  83.     INCLUDE 'M16.Desk'
  84.     INCLUDE 'M16.Texttool'
  85.     PRINT POP
  86.  
  87. *******************************************************************************
  88. *
  89. *    Equates used in this program.
  90. *
  91. *******************************************************************************
  92. DPHandle    equ 0    ; Handle to Tool Direct Page area
  93. DPPointer    equ DPHandle+4    ; Pointer to Tool Direct Page area
  94. deref    equ DPPointer+4    ; Temporary Handle dereference area
  95. temp1    equ deref+4    ; used by DrawTime routine
  96.  
  97. ScreenMode    equ mode640
  98. ScreenWidth    equ 640
  99.  
  100.     EJECT
  101. *******************************************************************************
  102. *
  103. Main    PROC
  104. *
  105. * Description:    This is the main routine. It calls routines to Initialize
  106. *    the tools, initialize application specific data, run the
  107. *    main EventLoop, close the application, and close the tools.
  108. *    Then it calls the ProDOS Quit command.
  109. *
  110. *
  111. * Inputs:    NONE
  112. *
  113. * Outputs:    NONE
  114. *
  115. * External Refs:
  116.     import InitTools
  117.     import InitApp
  118.     import EventLoop
  119.     import CloseApp
  120.     import CloseTools
  121.     import QuitParms
  122. *
  123. * Entry Points:    NONE
  124. *
  125. *******************************************************************************
  126.  
  127.     jsr InitTools
  128.     jsr InitApp
  129.  
  130.     _ShowCursor
  131.  
  132.     jsr EventLoop
  133.  
  134.     jsr CloseApp
  135.     jsr CloseTools
  136.  
  137.     _Quit QuitParms
  138.  
  139.     ENDP
  140.  
  141.     EJECT
  142. *******************************************************************************
  143. *
  144. Globals    Record
  145. *
  146. * Description:    Holder of all of our data.
  147. *
  148. *
  149. * Inputs:    N/A
  150. *
  151. * Outputs:    N/A
  152. *
  153. * External Refs:
  154. *
  155. * Entry Points:
  156.     export QuitParms    ; used by Main
  157. *
  158. *******************************************************************************
  159. *
  160. * Standard global data
  161. *
  162. *******************************************************************************
  163.  
  164. TitleString    str 'Custom Window Sample'
  165. AutString    str 'By Keith Rollin, Apple II DTS'
  166. CopyString    str 'Copyright (c) 1988-1990 Apple Computer'
  167. VerString    str 'Version 3.0        June 19, 1990'
  168. AboutData    dc.b '73/*0',13,'*1',13,'*2',13,'*3/^#0',0
  169. SubStrings    dc.l TitleString,AutString,CopyString,VerString
  170.  
  171. MenuHeight    ds.B 2    ; Stored height of menu bar
  172. MyID    ds.B 2    ; Application ID
  173. MyDP    ds.B 2    ; My direct page storage
  174.  
  175. QuitFlag    ds.W 1
  176. QuitParms    dc.L 0    ; Pathname of next app
  177.     dc.W $00    ; flags
  178.  
  179. EventRecord
  180. EventWhat    ds.B 2
  181. EventMessage    ds.B 4
  182. EventWhen    ds.B 4
  183. EventWhere    ds.B 4
  184. EventModifiers    ds.B 2
  185. TaskData    ds.B 4
  186. TaskMask    dc.L $0000FFFF
  187.  
  188.     EJECT
  189. *******************************************************************************
  190. *
  191. * Application specific global data
  192. *
  193. *******************************************************************************
  194.  
  195. ; This is a list of pointers to the text that is used to create our menus. It
  196. ; is used by InitApp to find all of the menu templates and use them to create
  197. ; our menubar. This loop loads MenuPtrLen-4 into an index, gets the
  198. ; corresponding menu template pointer in this table, and uses that in a
  199. ; NewMenu call. It then decrements the index by 4, and repeats the procees
  200. ; until the index is negative.
  201.  
  202. MenuPtr    dc.l AppMenu
  203.     dc.l FileMenu
  204.     dc.l EditMenu
  205. MenuPtrLen    equ *-MenuPtr
  206.  
  207.  
  208. ; Menu list: menu items should be numbered consecutivly starting from 250.
  209. ; As a convention, use 256 as about and 257 as Quit.
  210.  
  211. AppMenu    dc.B '$$@\XN1',$00
  212.     dc.B '--About Custom Window...\N256V',$00
  213.     dc.B '.'
  214. FileMenu    dc.B '$$  File  \N2',$0D
  215.     dc.B '--Open Custom Window 1\N258',$00
  216.     dc.B '--Open Custom Window 2\N259',$00
  217.     dc.B '--Open Normal Window\N260',$00
  218.     dc.B '--Close\N255V',$00
  219.     dc.B '--Quit\N257*Qq',$00
  220.     dc.B '.'
  221. EditMenu    dc.B '$$  Edit  \N3',$00
  222.     dc.B '--Undo\N250*ZzVD',$00
  223.     dc.B '--Cut\N251*XxD',$00
  224.     dc.B '--Copy\N252*CcD',$00
  225.     dc.B '--Paste\N253*VvD',$00
  226.     dc.B '--Clear\N254D',$00
  227.     dc.B '.'
  228.  
  229. TestWindow    dc.L 0
  230. TestWindow2    dc.L 0
  231. NormalWindow    dc.L 0
  232.  
  233.     EndR
  234.  
  235.     EJECT
  236. *******************************************************************************
  237. *
  238. InitApp    PROC
  239. *
  240. * Description:    Perform any application specific initialization.
  241. *
  242. * Inputs:    NONE
  243. *
  244. * Outputs:    NONE
  245. *
  246. * External Refs:
  247.     import RRectDefProc
  248.     import doUpdate
  249. *
  250. * Entry Points:    NONE
  251. *
  252. *******************************************************************************
  253.     With Globals
  254.  
  255.     stz QuitFlag
  256.  
  257.     pha    ; space for the window pointer
  258.     pha
  259.     PushLong #NormWindRec
  260.     _NewWindow
  261.     PullLong NormalWindow
  262.  
  263.     pha    ; space for the window pointer
  264.     pha
  265.     PushLong #custWindRec
  266.     _NewWindow
  267.     PullLong TestWindow
  268.  
  269.     pha    ; space for the window pointer
  270.     pha
  271.     PushLong #custWindRec2
  272.     _NewWindow
  273.     PullLong TestWindow2
  274.  
  275.     rts
  276.  
  277. WindowTitle1    str '  Custom Window #1  '
  278. WindowTitle2    str '  Custom Window #2  '
  279. WindowTitle3    str '  I am a Normal Window  '
  280.  
  281. myColors    dc.w $0010 ; Frame color (7-4)
  282.     dc.w $02F0 ; Inact ttlbar(11-8), inact ttl(7-4), title (3-0)
  283.     dc.w $0005 ; Background color (active titlebar) (3-0)
  284.  
  285. custWindRec    dc.w 0
  286.     dc.l RRectDefProc
  287.     dc.w 0    ; FrameBits
  288.     dc.w 40,100,160,500    ; bounding rectangle
  289.     dc.l $FFFFFFFF    ; plane
  290.     dc.l 0    ; storage
  291.     dc.l 0    ; refCon
  292.     dc.l doUpdate    ; contDraw
  293.     dc.l WindowTitle1    ; window's title
  294.     dc.l myColors    ; colorTable
  295.     dc.w $10    ; vertical radius
  296.     dc.w $20    ; horizontal radius
  297.  
  298. custWindRec2    dc.w 0
  299.     dc.l RRectDefProc
  300.     dc.w fClose+fMove
  301.     dc.w 60,140,140,440    ; bounding rectangle
  302.     dc.l $FFFFFFFF    ; plane
  303.     dc.l 0    ; storage
  304.     dc.l 0    ; refCon
  305.     dc.l doUpdate    ; contDraw
  306.     dc.l WindowTitle2    ; window's title
  307.     dc.l 0    ; colorTable
  308.     dc.w $10    ; vertical radius
  309.     dc.w $20    ; horizontal radius
  310.  
  311. NormWindRec    DC.W WindEnd-NormWindRec
  312.     DC.W fTitle+fClose+fMove
  313.     DC.L WindowTitle3    ; Ptr to title
  314.     DC.L $0    ; RefCon
  315.     DC.W 0,0,0,0    ; Full Size (0= default)
  316.     DC.L 0    ; Color Table Pointer
  317.     DC.W 0,0    ; Vertical/Horizontal origin
  318.     DC.W 0,0    ; Data area height,    width
  319.     DC.W 0,0    ; Max Cont height, width
  320.     DC.W 0,0    ; Pixels to scroll vert'ly, horiz'ly
  321.     DC.W 0,0    ; Pixels to page vert'ly, horiz'ly
  322.     DC.L 0    ; Information bar refcon.
  323.     DC.W 0    ; Info bar height
  324.     DC.L 0    ; DefProc.
  325.     DC.L 0    ; Routine to draw info. bar.
  326.     DC.L doUpdate    ; Routine to draw content.
  327.     DC.W 40,40,120,590    ; Size and position
  328.     DC.L $FFFFFFFF    ; Plane to put window up in (bottommost).
  329.     DC.L 0    ; Address for window record (0 to alloc)
  330. WindEnd    equ *
  331.  
  332.     ENDP
  333.  
  334.     EJECT
  335. *******************************************************************************
  336. *
  337. CloseApp    PROC
  338. *
  339. * Description:    Close down things. This disposes of all items and memory
  340. *    that we allocated.
  341. *
  342. *
  343. * Inputs:    NONE
  344. *
  345. * Outputs:    NONE
  346. *
  347. * External Refs:    NONE
  348. *
  349. * Entry Points:    NONE
  350. *
  351. *******************************************************************************
  352.     With Globals
  353.  
  354.     PushLong TestWindow
  355.     _CloseWindow
  356.  
  357.     PushLong TestWindow2
  358.     _CloseWindow
  359.  
  360.     PushLong NormalWindow
  361.     _CloseWindow
  362.  
  363.     rts
  364.     ENDP
  365.  
  366.     EJECT
  367. *******************************************************************************
  368. *
  369. EventLoop    PROC
  370. *
  371. * Description:    Main Event Loop. Handle things until user selects Quit.
  372. *
  373. *
  374. * Inputs:    NONE
  375. *
  376. * Outputs:    NONE
  377. *
  378. * External Refs:
  379.     import MenuSelect
  380.     import Ignore
  381.     import doUpdate
  382.     import doNullEvent
  383.     import doClose
  384. *
  385. * Entry Points:    NONE
  386. *
  387. *******************************************************************************
  388.     With Globals
  389.  
  390. maxEvent    equ wInactMenu
  391.  
  392.     pha    ; Push on space for TaskMaster result
  393.     PushWord #everyEvent ; GetNextEvent mask
  394.     PushLong #EventRecord ; Pointer to Event Record
  395.     _TaskMaster
  396.  
  397.     pla    ; Get TaskMaster result
  398.     cmp #maxEvent+1    ; do we know this event?
  399.     blt TaskOK    ; yes - so do it.
  400.     lda #inNull    ; map unknowns to null events
  401. TaskOK    asl a    ; Turn it into an index
  402.     tax
  403.     jsr (TaskTable,x)    ; Call appropriate event handler
  404.  
  405.     lda QuitFlag    ; Quit selected?
  406.     beq EventLoop    ; no - keep looping
  407.  
  408.     rts    ; yes- leave the program
  409.  
  410. TaskTable    dc.W doNullEvent    ; 0 Null
  411.     dc.W Ignore    ; 1 MouseDown
  412.     dc.W Ignore    ; 2 MouseUp
  413.     dc.W Ignore    ; 3 KeyDown
  414.     dc.W Ignore    ; 4 undefined
  415.     dc.W Ignore    ; 5 AutoKey
  416.     dc.W Ignore    ; 6 Update
  417.     dc.W Ignore    ; 7 undefined
  418.     dc.W Ignore    ; 8 Activate
  419.     dc.W Ignore    ; 9 Switch
  420.     dc.W Ignore    ; 10 Desk accessory
  421.     dc.W Ignore    ; 11 Device driver
  422.     dc.W Ignore    ; 12 ap
  423.     dc.W Ignore    ; 13 ap
  424.     dc.W Ignore    ; 14 ap
  425.     dc.W Ignore    ; 15 ap
  426.     dc.W Ignore    ; TASK 0 indesk
  427.     dc.W MenuSelect    ; TASK 1 in menuBar
  428.     dc.W Ignore    ; TASK 2 in system window
  429.     dc.W Ignore    ; TASK 3 in content
  430.     dc.W Ignore    ; TASK 4 in Drag
  431.     dc.W Ignore    ; TASK 5 in grow
  432.     dc.W doClose    ; TASK 6 in goaway
  433.     dc.W Ignore    ; TASK 7 in zoom
  434.     dc.W Ignore    ; TASK 8 in info bar
  435.     dc.W MenuSelect    ; TASK 9 in special    menu
  436.     dc.W Ignore    ; TASK 10 in NDA
  437.     dc.W Ignore    ; TASK 11 in frame
  438.     dc.W Ignore    ; TASK 12 in drop
  439.  
  440.     ENDP
  441.  
  442.     EJECT
  443. *******************************************************************************
  444. *
  445. MenuSelect    PROC
  446. *
  447. * Description:    This routine is called when TaskMaster returns a menu
  448. *    event. It takes the menu item that was hit and calculates
  449. *    an offset into the menu dispatch table. It then calls that
  450. *    routine and unhilites the menu when it is done.
  451. *
  452. * Inputs:    TaskData holds menu item selected.
  453. *
  454. * Outputs:    NONE
  455. *
  456. * External Refs:
  457.     import Ignore
  458.     import doAbout
  459.     import doQuit
  460.     import doOpen1
  461.     import doOpen2
  462.     import doOpen3
  463.     import doClose
  464. *
  465. * Entry Points:    NONE
  466. *
  467. *******************************************************************************
  468.     With Globals
  469.  
  470.     lda TaskData    ; Get the ID of the menu item selected.
  471.     sec    ; Turn it into an index by subtracting
  472.     sbc #250    ; the starting ID number (250) and mul-
  473.     asl a    ; tiplying by 2 (each table entry con-
  474.     tax    ; sists of 2 bytes).
  475.     jsr (MenuTable,x)    ; Call the routine behind it.
  476.  
  477.     PushWord #0    ; Routine done - unhilite the menubar.
  478.     PushWord TaskData+2
  479.     _HiLiteMenu
  480.  
  481.     rts
  482.  
  483. MenuTable    dc.W Ignore    ; undo
  484.     dc.W Ignore    ; cut
  485.     dc.W Ignore    ; copy
  486.     dc.W Ignore    ; paste
  487.     dc.W Ignore    ; clear
  488.     dc.W doClose    ; close
  489.     dc.W doAbout    ; about this program
  490.     dc.W doQuit    ; quit selected
  491.     dc.W doOpen1    ; open a custom window
  492.     dc.W doOpen2    ; open another custom window
  493.     dc.W doOpen3    ; open a normal window
  494.     ENDP
  495.  
  496.     EJECT
  497. *******************************************************************************
  498. *
  499. Ignore    PROC
  500. *
  501. * Description:    Called when I want to ignore an event.
  502. *
  503. *
  504. * Inputs:    NONE
  505. *
  506. * Outputs:    NONE
  507. *
  508. * External Refs:    NONE
  509. *
  510. * Entry Points:    NONE
  511. *
  512. *******************************************************************************
  513.  
  514.     rts
  515.     ENDP
  516.  
  517.     EJECT
  518. *******************************************************************************
  519. *
  520. doNullEvent    Proc
  521. *
  522. * Description:    Performs tasks when there is nothing else to do...In this
  523. *    case, draw the time in the menubar.
  524. *
  525. *
  526. * Inputs:    NONE
  527. *
  528. * Outputs:    NONE
  529. *
  530. * External Refs:    NONE
  531. *
  532. * Entry Points:    NONE
  533. *
  534. *******************************************************************************
  535.     With Globals
  536.  
  537.     pha    ; get the time
  538.     pha
  539.     pha
  540.     pha
  541.     _ReadTimeHex
  542.  
  543.     lda 1,s    ; compare to see if 1 second
  544.     cmp oldTime    ; has passed...
  545.     bne DrawTime
  546.  
  547.     lda 3,s
  548.     cmp oldTime+2
  549.     bne DrawTime
  550.  
  551.     lda 5,s
  552.     cmp oldTime+4
  553.     bne DrawTime
  554.  
  555.     lda 7,s
  556.     cmp oldTime+6
  557.     bne DrawTime
  558.     brl ExitNull    ; no it hasn't...do nothing
  559.  
  560. DrawTime        ; time has passed, draw it.
  561.     pha    ; save the old port
  562.     pha
  563.     _GetPort
  564.     PullLong oldPort
  565.  
  566.     pha    ; switch to the menu manager port
  567.     pha
  568.     _GetMenuMgrPort
  569.     lda 1,s    ; save this for metrics later
  570.     sta temp1
  571.     lda 3,s
  572.     sta temp1+2
  573.     _SetPort
  574.  
  575.     PushLong #TimeString ; get the time as a string
  576.     _ReadAsciiTime
  577.  
  578.     ldx #18    ; strip off the high bits
  579. loop    lda TimeString,x
  580.     and #$7F7F
  581.     sta TimeString,x
  582.     dex
  583.     dex
  584.     bpl loop
  585.  
  586.     pha    ; get the length of the time string
  587.     PushLong #TimeString
  588.     _CStringWidth
  589.  
  590. ; put it on the screen so that its right edge is 10 pixels from
  591. ; the right edge of the screen. It is always positioned 10 pixels
  592. ; down from the top of the screen.
  593.  
  594.     ldy #oportRect+6
  595.     lda [<temp1],y
  596.     sec
  597.     sbc 1,s    ; subtract the width on the stack
  598.     sbc #10    ; plus some...
  599.     sta 1,s    ; push on the X-Coord
  600.     ldy #oportRect
  601.     lda [<temp1],y
  602.     clc
  603.     adc #10    ; push on the Y-coord
  604.     pha
  605.     _MoveTo
  606.  
  607. ; Save and set the text mode to modeCopy
  608.     pha
  609.     _GetTextMode
  610.  
  611.     PushWord #0
  612.     _SetTextMode
  613.  
  614. ; Finally draw the string
  615.  
  616.     PushLong #TimeString
  617.     _DrawCString
  618.  
  619. ; Reset the text mode and the GrafPort
  620.  
  621.     _SetTextMode
  622.  
  623.     PushLong oldPort
  624.     _SetPort
  625.  
  626. ExitNull
  627.     PullLong oldTime
  628.     PullLong oldTime+4
  629.  
  630.     rts
  631.  
  632. oldTime    dc.b 0,0,0,0,0,0,0,0
  633. oldPort    ds.b 4
  634.  
  635. TimeString    DS.B 20
  636.     DC.B 0
  637.  
  638.     ENDP
  639.  
  640.     EJECT
  641. *******************************************************************************
  642. *
  643. doUpdate    PROC
  644. *
  645. * Description:    Called by TaskMaster to perform updates. This routine
  646. *    does nothing, as we have nothing to update with!
  647. *
  648. *
  649. * Inputs:    NONE
  650. *
  651. * Outputs:    NONE
  652. *
  653. * External Refs:    NONE
  654. *
  655. * Entry Points:    NONE
  656. *
  657. *******************************************************************************
  658.     with Globals
  659.  
  660.     rtl
  661.     ENDP
  662.  
  663.     EJECT
  664. *******************************************************************************
  665. *
  666. doQuit    PROC
  667. *
  668. * Description:    Quit routine. Set the QuitFlag to TRUE for the EventLoop.
  669. *
  670. *
  671. * Inputs:    NONE
  672. *
  673. * Outputs:    QuitFlag set to $FFFF
  674. *
  675. * External Refs:    NONE
  676. *
  677. * Entry Points:    NONE
  678. *
  679. *******************************************************************************
  680.     With Globals
  681.  
  682.     lda #$FFFF
  683.     sta QuitFlag
  684.     rts
  685.     ENDP
  686.  
  687.  
  688.     EJECT
  689. *******************************************************************************
  690. *
  691. doAbout    PROC
  692. *
  693. * Description:    Bring up an AlertWindow box with our name in it. This call
  694. *    was added on System Disk 3.2.
  695. *
  696. * Inputs:    NONE
  697. *
  698. * Outputs:    NONE
  699. *
  700. * External Refs:    NONE
  701. *
  702. * Entry Points:    NONE
  703. *
  704. *******************************************************************************
  705.     With Globals
  706.  
  707.     pha    ; space for result
  708.     PushWord #1    ; we are using P-Strings
  709.     PushLong #SubStrings
  710.     PushLong #AboutData
  711.     _AlertWindow    ; new macro defined above
  712.     pla    ; pull off button hit
  713.  
  714.     rts
  715.  
  716.     ENDP
  717.  
  718.     EJECT
  719. *******************************************************************************
  720. *
  721. doOpen    proc
  722. *
  723. * Description:    Opens a window by making it visible.
  724. *
  725. *
  726. * Inputs:    NONE
  727. *
  728. * Outputs:    NONE
  729. *
  730. * External Refs:    NONE
  731. *
  732. * Entry Points:
  733.     entry doOpen1
  734.     entry doOpen2
  735.     entry doOpen3
  736. *
  737. *******************************************************************************
  738.     with Globals
  739.     
  740. doOpen1    lda TestWindow
  741.     ldx TestWindow+2
  742.     bra CommonOpen
  743.  
  744. doOpen2    lda TestWindow2
  745.     ldx TestWindow2+2
  746.     bra CommonOpen
  747.  
  748. doOpen3    lda NormalWindow
  749.     ldx NormalWindow+2
  750.  
  751. CommonOpen
  752.     phx    ; push the window ptr on for ShowWind
  753.     pha
  754.     phx    ; and push a set on for Select
  755.     pha
  756.     _SelectWindow    ; bring it to front
  757.     _ShowWindow    ; and show it.
  758.  
  759.     rts
  760.  
  761.     ENDP
  762.  
  763.  
  764.     EJECT
  765. *******************************************************************************
  766. *
  767. doClose    proc
  768. *
  769. * Description:    Closes a window by making it invisible.
  770. *
  771. *
  772. * Inputs:    NONE
  773. *
  774. * Outputs:    NONE
  775. *
  776. * External Refs:    NONE
  777. *
  778. * Entry Points:    NONE
  779. *
  780. *******************************************************************************
  781.     with Globals
  782.  
  783.     pha    ; get the front window
  784.     pha
  785.     _FrontWindow
  786.     _HideWindow    ; and hide it
  787.  
  788.     rts
  789.     ENDP
  790.  
  791.     Include 'cwnd.inits.aii'
  792.     Include 'rr.window.aii'
  793.  
  794.     END
  795.  
  796.